﻿using System.Windows;
using System.Windows.Controls;

namespace Poet.Resources
{
    partial class Styles
    {
        private void InvertIsChecked(object sender, RoutedEventArgs e)
        {
            var menuItem = (MenuItem) sender;
            if (!menuItem.IsChecked && menuItem.Tag != null)
            {
                menuItem.IsChecked = true;
                return;
            }

            if (menuItem.ItemsSource != null && !menuItem.IsFocused) return;
            menuItem.IsChecked = !menuItem.IsChecked;
            e.Handled = true;
        }

        private void UbdateBindings(object sender, RoutedEventArgs e)
        {
            var control = (Control)sender;
            Foundation.ExtensionMethods.CommonExtensions.UpdateBindingTargets(control);
        }
    }
}
